﻿@page "/sdk/server/job/m/{RecordId}/plan"

@model WebVella.Erp.Plugins.SDK.Pages.Job.PlanManageModel
@using WebVella.Erp.Web.Utils;
@{
	Layout = "~/Pages/_AppMaster.cshtml";
	ViewData["Title"] = "Manage Plan";
}
<wv-page-header color="#dc3545" area-label="Jobs" title="Manage a Plan"
				icon-class="fa fa-pencil-alt" return-url="@Model.ReturnUrl">
	<wv-page-header-actions>
		<wv-button type="Submit" form="ManageRecord" size="Small" color="Primary" icon-class="fa fa-save go-white" text="Save Plan"></wv-button>
		<wv-button type="LinkAsButton" size="Small" href="@Model.ReturnUrl" text="Cancel" color="White"></wv-button>
	</wv-page-header-actions>

</wv-page-header>

<wv-validation errors="@Model.Validation.ToErrorList()" message="@Model.Validation.Message"></wv-validation>

<wv-form id="ManageRecord" name="ManageRecord" validation-errors="Model.Validation.ToErrorList()" label-mode="Stacked" mode="Form" autocomplete="false">
	<wv-section class="mt-4">
		<wv-row>
			<wv-column span="6">
				<wv-field-checkbox label-text="Enabled" value="@Model.Enabled" name="Enabled" text-true="enable this schedule plan"></wv-field-checkbox>
			</wv-column>
			<wv-column span="6">
				<wv-field-guid label-text="Id" value="@Model.Id" access="ReadOnly" name="Id"></wv-field-guid>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-text label-text="Name" value="@Model.Name" name="Name" required="true"></wv-field-text>
			</wv-column>
			<wv-column span="6">
				<wv-field-text label-text="Job Type" value="@Model.JobTypeName" access="ReadOnly" name="JobTypeName"></wv-field-text>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-datetime label-text="Start Date" value="@Model.StartDate" name="StartDate"></wv-field-datetime>
			</wv-column>
			<wv-column span="6">
				<wv-field-datetime label-text="End Date" value="@Model.EndDate" name="EndDate"></wv-field-datetime>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-select label-text="Type" value="@Model.Type" name="Type" options="Model.SchedulePlanTypeOptions.ToWvSelectOption()"></wv-field-select>
			</wv-column>
			<wv-column span="6">
				<wv-field-datetime access="ReadOnly" label-text="Next Trigger" value="@Model.NextTriggerTime" name="NextTriggerTime"></wv-field-datetime>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-number decimal-digits="0" step="1" min="0" label-text="Trigger Each" value="@Model.IntervalInMinutes" name="IntervalInMinutes">
					<wv-field-append><span class='input-group-text'>minutes</span></wv-field-append>
				</wv-field-number>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="12">
				<wv-field-checkbox-list options="@Model.WeekOptions.ToWvSelectOption()" label-text="Schedule days" value="@Model.ScheduledDays" name="ScheduledDays"></wv-field-checkbox-list>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-time label-text="StartTimespan" value="@Model.StartTimespan" name="StartTimespan">
					<wv-field-prepend><span class='input-group-text'><i class='far fa-fw fa-clock'></i></span></wv-field-prepend>
				</wv-field-time>
			</wv-column>
			<wv-column span="6">
				<wv-field-time label-text="EndTimespan" value="@Model.EndTimespan" name="EndTimespan">
					<wv-field-prepend><span class='input-group-text'><i class='far fa-fw fa-clock'></i></span></wv-field-prepend>
				</wv-field-time>
			</wv-column>
		</wv-row>
	</wv-section>
</wv-form>
